package com.heifeng.cloudshelf.mvp.programme.presenter;

import com.bumptech.glide.Glide;
import com.heifeng.cloudshelf.R;
import com.heifeng.cloudshelf.base.RxPresenter;
import com.heifeng.cloudshelf.mvp.programme.contract.VideoPlayerActivityContract;
import com.heifeng.cloudshelf.widget.CustomVideoPlayer;
import com.heifeng.cloudshelf.widget.JZMediaExo;

import javax.inject.Inject;

import cn.jzvd.Jzvd;

/**
 * Created by admin on 2019/10/11.
 */

public class VideoPlayerActivityPresenter extends RxPresenter<VideoPlayerActivityContract.View> implements VideoPlayerActivityContract.Presenter {
    @Inject
    public VideoPlayerActivityPresenter() {
    }

    public void initVideoPlayer(CustomVideoPlayer videoPlayer) {
        videoPlayer.setAllowPlay(true);//设置视频是否允许播放
        videoPlayer.setLayoutTopBgNull();//不显示顶部半透明层
        videoPlayer.setUp(mView.getVideoUrl()
                , "", Jzvd.SCREEN_NORMAL, JZMediaExo.class);
        //设置视频预览图,预览图链接为空，则是黑色背景
        Glide.with(mContext).load(R.mipmap.pic_videos_default).into(videoPlayer.thumbImageView);
    }
}
